<div id="draw-apply" class="apply">
	<h4>提现最小额度10元。</h4>
	<h4>提现申请后1个工作日可到账，请务必正确填写你的收款支付宝账号和对应的真实姓名，否则相关损失将由你自行承担。</h4>
	<h5>账户余额：<span><em>${onlineUser.account_balance}</em> 元</span>
	</h5>
	<#if onlineUser.alipay??>
	<form id="save-draw-apply" action="/user/saveDrawApply" method="post" accept-charset="utf-8">
		${token!}
		<div class="field">
			<label>提现金额：</label>
			<input type="text" value="" name="money" placeholder="输入金额" data-balance="${onlineUser.account_balance}" data-once="${onlineUser.account_balance}" data-max="${onlineUser.account_balance?int}" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
			<span>提现金额必须为整数</span>
		</div>
		<div class="submit">
			<a href="javascript:void(0);" class="btn" hidefocus="true">申请提现</a>
		</div>
	</form>
	<#else>
	<div class="error-tip">你还没有设置提现信息，
		<a href="javascript:void(0);" hidefocus="true" id="error-setting">点此立即设置 &gt;&gt;</a>
	</div>
	</#if>
</div>
<script type="text/javascript">
if($("#draw-apply .btn")[0]){
	$("#draw-apply .btn").click(function(){
		var options = {
			dataType:"json",
			beforeSubmit:function(formData,jqForm,options){
				var formElement = $(jqForm[0]),
				money = formElement.find("input[name='money']");
				
				if($.koorz.util.isEmpty(money.val())){
		  			alert("请填提现金额,不能为空");
		            return false;
		  		}else if((!$.koorz.util.isEmpty(money.val())) && (money.val() > money.attr("data-max"))){
		  			alert("您的余额只有"+money.attr('data-balance')+"元。");
		            return false;
		  		}else if(money.val() <= 0){
		  			alert("提现金额必须大于0");
		            return false;
		  		}
		  		return true;
			},
		   	success:function(resp, status){
		   		if(status == 'success'){
		   			alert(resp.msg);
		   			$(".assets-navi .tab")[4].click();
				}
		   	}
		};
		$("#save-draw-apply").ajaxSubmit(options);
		return false;
	});	
}
if($("#error-setting")[0]){
	//点此立即设置提现
	$("#error-setting").click(function(){
		$(".assets-navi .tab")[3].click();
	});	
}
</script>